package com.xtoneict.util.mp;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

/**
 * 在插入数据时自动将User对象中isDeleted字段填充为0
 */

@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {

        this.fillStrategy(metaObject, "isDeleted", 0);

        this.fillStrategy(metaObject, "passStatus", 0);

    }

    @Override
    public void updateFill(MetaObject metaObject) {

        this.fillStrategy(metaObject, "isDeleted", 0);

        this.fillStrategy(metaObject, "passStatus", 0);

    }
}